<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="../assets/js/vue.js"></script>
    <title>Examples Method Demo</title>
</head>
<body>
    <h1>Examples Method Demo</h1>
    <hr>
    <div id="app">
        <!-- {{message}} -->
        
    </div>
    <p><button onclick="destroy()">卸载</button></p>
    <p><button onclick="reload()">刷新</button></p>
    <p><button onclick="tick()">更新</button></p>
    <script type="text/javascript">
      var lifeng = Vue.extend({
          template:`<div>{{message}}
          </div>`,
          data(){
              return {
                  message:"大家好，我是李锋"
              }
          },
          mounted(){
            console.log("被创建")
          },
          destroyed () {
            console.log("10 destroyed")
          },
          updated() {
              console.log("更新之后")
          },
      })
      var vm =  new lifeng().$mount("#app");
      
      function destroy(){
          vm.$destroy()
      }
      function reload(){
          vm.$forceUpdate()
      }
      function tick(){
          vm.message = "更新之后的消息";
          vm.$nextTick(()=>{
              console.log("更新之后我被调用了")
          })
      }
    </script>
</body>
</html>